﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using TA.Turbo;
using TA.Turbo.Controls;

public partial class SimpleForm_Default : TPage
{
	protected override void OnInit(EventArgs e)
	{
		base.OnInit(e);

		((TemplateNode)this.tv.Nodes[0].Children[1].Children[0]).Value = new
		{
			A = "A",
			B = 1,
		};
		((TemplateNode)this.tv.Nodes[0].Children[1].Children[1]).Value = new
		{
			A = "B",
			B = 2,
		};
	}
	protected void tv_LoadNodes(object s, LoadNodesEventArgs e)
	{
		switch (e.Node.UniqueId)
		{
			case "tnExp1":
				e.Result.Add(new HyperLinkNode { Text = "MSN", Href = "http://www.msn.com/" });
				e.Result.Add(new HyperLinkNode { Text = "The Daily WTF", Href = "http://www.thedailywtf.com/" });
				break;
			case "tnExp2":
				e.Result.Add(new TemplateNode
				{
					Value = new
					{
						A = "C",
						B = 3,
					}
				});
				e.Result.Add(new TemplateNode
				{
					Value = new
					{
						A = "D",
						B = 4,
					}
				});
				break;
		}
	}
	protected void btnTest_Click(object s, EventArgs e)
	{
		this.txtChecked.Value =
			(((CheckBoxNode)this.tv.Nodes.FindById("tnCB1")).Checked ? "CB1 " : "")
			+
			(((CheckBoxNode)this.tv.Nodes.FindById("tnCB2")).Checked ? "CB2 " : "")
			;
	}
}
